//
//  APPConfig.h
//  car_service_seller
//
//  Created by  LiuBi_GC_iMac on 2018/5/29.
//  Copyright © 2018年 cn.sixarm.seller. All rights reserved.
//

#ifndef APPConfig_h
#define APPConfig_h


#ifndef DEBUG
#define DEBUG 1
#endif

#define Font(x) [UIFont systemFontOfSize:(x)]

#pragma mark -----  颜色函数
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]


// ------  16进制RGB的颜色颜色  ------
#define FFColor(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

#define IS_IPHONE_G5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )

#define RGBACOLOR(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]

#define KNOTIFICATION_LOGINCHANGE @"loginStateChange"

#define CHATVIEWBACKGROUNDCOLOR [UIColor colorWithRed:0.936 green:0.932 blue:0.907 alpha:1]

//页面背景色
#define ViewBgColor RGBACOLOR(230,230,230,1)

#pragma mark - 自定义Log
#ifdef DEBUG
#define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#define DLog(...)
#endif


/**
 *  设备的信息
 **/
// 当前设备的ios系统版本
#define IOS7_VERSION (([[UIDevice currentDevice].systemVersion floatValue]) >= 7.0)
#define IOS8_VERSION (([[UIDevice currentDevice].systemVersion floatValue]) >= 8.0)
#define IOS9_VERSION (([[UIDevice currentDevice].systemVersion floatValue]) >= 9.0)
#define IOS10_VERSION (([[UIDevice currentDevice].systemVersion floatValue]) >= 10.0)

#define APP_INFO_URL                @"https://itunes.apple.com/cn/lookup?id=1182861898"
#define APP_DOWNLOAD_URL            @"https://itunes.apple.com/app/id1182861898"

#define SCREEN_BOUNDS    [[UIScreen mainScreen] bounds]                   // 设备的宽和高
#define VIEW_WIDTH       SCREEN_BOUNDS.size.width                         // 设备的宽
#define VIEW_HEIGHT      SCREEN_BOUNDS.size.height                        // 设备的高

#ifndef SCREEN_WIDTH
#define SCREEN_WIDTH  ([UIScreen mainScreen].bounds.size.width)        // 设备的宽
#endif

#ifndef kScreenWidth
#define kScreenWidth  ([UIScreen mainScreen].bounds.size.width)        // 设备的宽
#endif

#define SizeScale (SCREEN_WIDTH != 414 ? 1 : 1.1)
#define kFont(value) [UIFont systemFontOfSize:value * SizeScale]

#ifndef SCREEN_HEIGHT
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)       // 设备的高
#endif

#ifndef kScreenHeight
#define kScreenHeight ([UIScreen mainScreen].bounds.size.height)       // 设备的高
#endif

#define CENTER_X self.frame.size.width/2
#define CENTER_Y self.frame.size.height/2

#define VIEW_CENTER_X self.view.frame.size.width/2
#define VIEW_CENTER_Y self.view.frame.size.height/2

#ifndef NAVIBAR_HEIGHT
#define NAVIBAR_HEIGHT 64.0                                               // 导航条
#endif

#ifndef TABBAR_HEIGHT
#define TABBAR_HEIGHT 49.0                                                // TAB BAR HEIGHT
#endif

#ifndef RESET_PHONE_PWD_X
#define RESET_PHONE_PWD_X   16
#endif

#define SETUP_CELL_HEIGHT  50.0                                           // 所有设置页面的cell的高度

#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_RETINA ([[UIScreen mainScreen] scale] >= 2.0)

#define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
#define SCREEN_MIN_LENGTH (MIN(SCREEN_WIDTH, SCREEN_HEIGHT))

#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
#define IS_IPHONE_5 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
#define IS_IPHONE_6 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
#define IS_IPHONE_6P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)
//#define IS_IPHONE_X (CGSizeEqualToSize(CGSizeMake(375.f, 812.f), [UIScreen mainScreen].bounds.size) || CGSizeEqualToSize(CGSizeMake(812.f, 375.f), [UIScreen mainScreen].bounds.size))
#define IS_IPHONE_X ((int)((kScreenHeight/kScreenWidth)*100) == 216)?YES:NO

// 主色  绿色
#define PROJECT_DEFAULT_COLOR [UIColor colorWithRed:80.0/255.0 green:172.0/255.0 blue:204.0/255.0 alpha:1.0]
// 黄色
#define PROJECT_YELLOW_COLOR [UIColor colorWithRed:255.0/255.0 green:208.0/255.0 blue:38.0/255.0 alpha:1.0]
// 黑色
#define PROJECT_BLACK_COLOR [UIColor colorWithRed:51.0/255.0 green:51.0/255.0 blue:51.0/255.0 alpha:1.0]
// 背景色
#define PROJECT_BG_COLOR [UIColor colorWithRed:235.0/255.0 green:235.0/255.0 blue:235.0/255.0 alpha:1.0]
// 灰色
#define PROJECT_GRAY_COLOR [UIColor colorWithRed:155.0/255.0 green:155.0/255.0 blue:155.0/255.0 alpha:1.0]
// 分割线颜色
#define PROJECT_LINE_COLOR [UIColor colorWithRed:230.0/255.0 green:230.0/255.0 blue:230.0/255.0 alpha:1.0]
// 浅灰
#define PROJECT_LIGHT_GRAY_COLOR [UIColor colorWithRed:235.0/255.0 green:235.0/255.0 blue:235.0/255.0 alpha:1.0]

#define PROJECT_PLACEHOLDER_HEAD_IMAGE               [UIImage imageNamed:@"me_placehold_icon"]
#define PROJECT_PLACEHOLDER_IMAGE_TOP_SCROLL    [UIImage imageNamed:@"cve_placeholder_image_top_scroll"]
#define PROJECT_PLACEHOLDER_IMAGE_COURSE        [UIImage imageNamed:@"cve_placeholder_image_course"]

#define REQUEST_PAGE_SIZE @10

#define BORDER_COLOR [UIColor lightGrayColor].CGColor
#define BORDER_WIDTH (1 / 2)

/**
 *  应用的字体大小
 **/
#define FONT_SIZE_10   10.0
#define FONT_SIZE_11   11.0
#define FONT_SIZE_12   12.0
#define FONT_SIZE_13   13.0
#define FONT_SIZE_14   14.0
#define FONT_SIZE_15   15.0
#define FONT_SIZE_16   16.0
#define FONT_SIZE_18   18.0

/**
 *  应用的字体颜色
 **/
#define TEXT_COLOR_BLACK1    0x2A2A2A
#define TEXT_COLOR_BLACK2    0x666666
#define TEXT_COLOR_GRAY      0xA5A5A5
#define TEXT_COLOR_RED       0xD30617   // 红色

#define TEXT_COLOR_GRAY1     0xC4C4C4
#define TEXT_COLOR_GRAY2     0x93A7AC   // 灰蓝色
#define TEXT_COLOR_GRAY3     0x86989D
#define TEXT_COLOR_GRAY4     0xCCCCCC

#define NAV_BAR_COLOR 0x333333  //黑色导航栏背景颜色
#define NAV_BAR_TITLE_COLOR 0xFFFFFF

#define kSafeAreaBottomHeight (kScreenHeight == 812.0 ? 34 : 0)

#if __has_feature(objc_arc)
#define BLOCK_SELF(type) __weak type *block_self=self;
#else
#define BLOCK_SELF(type) __block type *block_self=self;
#endif

/**
 *  userdefault 中的key
 */
// 每日分享的次数
#define kDuoWeiShareCount(dateString) [NSString stringWithFormat:@"%@%@",@"kDuoWeiShareCount",dateString]
// 每日随机加粉次数
#define kDuoWeiRandomAddFansCount(dateString) [NSString stringWithFormat:@"%@%@",@"kDuoWeiRandomAddFansCount",dateString]
// 每日精准加粉次数
#define kDuoWeiAccurateAddFansCount(dateString) [NSString stringWithFormat:@"%@%@",@"kDuoWeiAccurateAddFansCount",dateString]
// 每日精准加粉提交任务的次数
#define kDuoWeiAccurateAddFansCommitCount(dateString) [NSString stringWithFormat:@"%@%@",@"kDuoWeiAccurateAddFansCommitCount",dateString]


#define USER_INFO                 @"USER_INFO"            // 用户信息
#define USER_LEVEL_INFO           @"USER_LEVEL_INFO"            // 用户等级信息
#define USER_IS_NEW               @"USER_IS_NEW"
#define USER_HOUSE                @"USER_HOUSE"
#define USER_HAVE_HOUSE           @"USER_HAVE_HOUSE"
#define REMOVE_SELF_WEBVIEW       @"REMOVE_SELF_WEBVIEW"
#define APP_AD_INFO               @"APP_AD_INFO"        //  APP广告信息
#define IS_SHOW_APP_AD            @"IS_SHOW_APP_AD"     //  是否显示APP广告
#define IS_SHOW_APP_AD_INFO       @"IS_SHOW_APP_AD_INFO"     //  是否显示APP广告详细信息
#define IS_SHOW_WINDOW_ANIMATION  @"IS_SHOW_WINDOW_ANIMATION"   //  是否显示转场动画（切换Window）
#define IS_USER_TOKEN_DID_LOSE    @"IS_USER_TOKEN_DID_LOSE" //  TOKEN失效 用来阻碍多次弹框的标识
///
#define USER_HEAD           @"头像"
#define USER_NAME           @"姓名"
#define USER_SEX            @"性别"
#define USER_BIRTH          @"生日"
#define USER_AREA           @"地区"
#define NO_COMPLETE_USER_INFO   @"NO_COMPLETE_USER_INFO"    // 需要完善个人信息
#define COMPLETE_USER_INFO      @"COMPLETE_USER_INFO"       // 不需要完善个人信息

#define USER_IS_COMPLETE_INFO   @"USER_IS_COMPLETE_INFO"    // 用户是否已经完善个人信息
#define USER_TOKEN              @"USER_TOKEN"               // token
#define USER_ACCOUNT            @"USER_ACCOUNT"             // 用户账号
#define USER_PASSWORD           @"USER_PASSWORD"            // 用户密码
#define DETAULT_LABELS          @"DETAULT_LABELS"           // 默认提供的标签
#define USER_CER_FINISHE_INFO   @"USER_CER_FINISHE_INFO"    // 认证完成信息

//  用户成功登录之后的信息
#define USER_LOGIN_SUCCESS_DATA        @"USER_LOGIN_SUCCESS_DATA"
//  用户第一次使用
#define IS_FIRST_USE_APP               @"IS_FIRST_USE_APP"

//  游客
#define USER_TOURIST        @"USER_TOURIST"

// 通知个数
#define NOTICE_NUMBERS_COUNT    @"NOTICE_NUMBERS_COUNT"

// 用户在其他客户端登陆
#define USER_LOGIN_AT_OTHER         @"USER_LOGIN_AT_OTHER"

// 切换window.root的控制器
#define SWITCH_WINDOW_ROOT_CONTROLLER   @"SWITCH_WINDOW_ROOT_CONTROLLER"
#define SWITCH_WINDOW_LOGIN_CONTROLLER   @"SWITCH_WINDOW_LOGIN_CONTROLLER"

#define SWITCH_WINDOW_FIRST_REGISTER_LOGIN @"SWITCH_WINDOW_FIRST_REGISTER_LOGIN"

#define SWITCH_COMMUNITY_REF_HOME_INFO   @"SWITCH_COMMUNITY_REF_HOME_INFO"

// userInfo 中的key
#define SWITCH_CONTROLLER       @"SWITCH_CONTROLLER_NAME"           // 控制器的名字


/**
 *  网络提示信息
 */
#define NET_ERROR               @"网络出现问题，请确认网络链接是否正常"

// 无数据时加载的图片
#define IMAGE_DEFAULT_IMGNAME       @"profile_default.png"
#define IMAGE_DEFAULT_LIST          [UIImage imageNamed:@"default_none.png"]
#define IMAGE_DEFAULT_NET_ERROR     [UIImage imageNamed:@"default_internet.png"]
// 无数据时显示的文本
#define TEXT_DEFAULT_LIST           @"一条数据也没有"
#define TEXT_DEFAULT_NET_ERROR      @"咦？网络去哪里了呢~"

//  惠居图片相关
#define IMAGE_CUT_DEFAULT               @"@1e_70w_70h_1c_0i_1o_90Q_1x.jpg"
#define IMAGE_CUT_CUSTOMIZE(w, h)       [NSString stringWithFormat:@"@1e_1c_0o_0l_90Q_%dw_%dh.jpg",(w),(h)]
#define UIImageJPEGZipRatio     0.25

#define IMAGE_MODULAR_HOME      @"home"
#define IMAGE_MODULAR_USER_ICON @"userIcon"
#define IMAGE_MODULAR_TOPIC_IMG @"topicImg"
#define IMAGE_MODULAR_SHOPS_IMG @"shopsImg"

#define COURSE_CELL_HEIGHT  122

/**
 *  分享
 */
// 分享内容的最大长度
#define SHARE_CONTETN_TEXT_MAX_COUNT    30
//选择相册图片缩放比例
#define SELECCT_IMAGE_SCALE  3.0f
/**
 *  监听网络
 */
#define NETWORK_STATE @"网络状态"
#define NOTREACHABLE @"NotReachable"
#define REACHABLEVIAWIFI @"ReachableViaWiFi"
#define REACHABLEVIAWWAN @"ReachableViaWWAN"
#define KVERSION @"网络状态"

#pragma mark - 工程相关

#define BACK_BTN_IMAGE_NAME             @"back_btn.png"
#define BACK_BTN_BLACK_IMAGE_NAME       @"back_btn_black.png"

#define LINE_VIEW_COLOR UIColorFromRGB(0xE1E3E2)

#define HUIJIE_TOAST(message)    \
{                               \
[MBProgressHUD showSuccess:message];   \
}                               \

#define IS_ALLOW_WIFI_PLAYER_VIDEO @"IS_ALLOW_WIFI_PLAYER_VIDEO"

#pragma mark - PROJECT_INTERFACE_URL
#define INTERFACE_SUCCESS_TRUE              @"true"     //返回数据判断成功
#define INTERFACE_SUCCESS_FALSE             @"false"    //返回数据判断失败

/** 屏幕比例 */
#define kScale kScreenWidth / 360
#define kMainFontFormat @"PingFang SC"
#define WeakSelf(weakSelf) __weak __typeof(&*self)weakSelf = self;

// 定义一个加上'w'前缀的weak变量，比如 DEFINE_WEAK(self)会生成 wself
#define DEFINE_WEAK(variable) __weak typeof(variable) weak##variable = variable;
#define WS(weakSelf)  __weak __typeof(&*self)weakSelf = self;

#define NavHeight ([UIApplication sharedApplication].statusBarFrame.size.height + 44);

#endif /* APPConfig_h */
